﻿<visi:VisiPage x:Class="VNet.VisiSuite.VisiAdmin.Views.StatusView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:visi="clr-namespace:VNet.VisiSuite.VisiAdmin.Controls"
             xmlns:ig="http://schemas.infragistics.com/xaml"
             xmlns:vm="clr-namespace:VNet.VisiSuite.VisiAdmin.ViewModels" 
             DataContext="{DynamicResource StatusViewModel}"
             xmlns:c="clr-namespace:VNet.VisiSuite.VisiAdmin.Controls" 
             xmlns:helper="clr-namespace:VNet.VisiSuite.VisiAdmin.Common.Helpers"
             xmlns:vuc="clr-namespace:VNet.VisiSuite.Controls;assembly=VNet.VisiSuite.Controls"
             xmlns:dg="http://infragistics.com/DataPresenter" 
             xmlns:igDock="http://infragistics.com/DockManager"
             xmlns:igWindows="http://infragistics.com/Windows" 
             xmlns:igDP="http://infragistics.com/DataPresenter"
             xmlns:system="clr-namespace:System;assembly=mscorlib"
             xmlns:converter="clr-namespace:VNet.VisiSuite.VisiAdmin.Common.Converters"
             d:DesignHeight="404.283" d:DesignWidth="961.136">
    <visi:VisiPage.Resources>
        <vm:StatusViewModel x:Key="StatusViewModel"/>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <converter:SelectedValuesConverter x:Key="SelectedValuesConverter" />
        <converter:InvertBooleanConverter x:Key="InvertBooleanConverter" />
        <converter:ObjectNullVisibilityConverter x:Key="ObjectNullVisibilityConverter" />
        <converter:InvertBooleanVisibilityConverter x:Key="InvertBooleanVisibilityConverter" />
        <converter:ReasonCodeToTextConverter x:Key="ReasonCodeToTextConverter" />
    </visi:VisiPage.Resources>

    <Grid Focusable="False" Background="{StaticResource WhiteColor}">
        <igDock:XamDockManager PaneDragStarting="PaneDragStarting">
            <igDock:ContentPane Style="{StaticResource NoHeaderPane}">
                <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="42" />
                    </Grid.RowDefinitions>

                    <!--Header-->
                    <c:Header2Control Grid.Row="0" Title="{Binding PageTitle}" LeftMenuIcons="{Binding TopLeftButtonIcons}" RightMenuIcons="{Binding TopRightButtonIcons}" />

                    <!--Body-->
                    <Grid Grid.Row="1">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <TextBlock Style="{StaticResource CaptionTextBlockStyle}" Grid.Row="0" Text="Select an item from the list below to view details." />
                        <TextBlock Style="{StaticResource ErrorTextBlockStyle}" Grid.Row="1" Text="{Binding ErrorMessage}"
                                    Visibility="{Binding ErrorMessage,Converter={StaticResource ObjectNullVisibilityConverter},ConverterParameter=Collapsed}" />

                        <Grid Grid.Row="2">
                            <dg:XamDataPresenter DataSource="{Binding Path=VisiBoardStatuses}" ActiveDataItem="{Binding SelectedObject}" Style="{StaticResource XamDataPresenterStyle}">
                                <dg:XamDataPresenter.FieldSettings>
                                    <dg:FieldSettings AllowEdit="False" AllowRecordFiltering="True" LabelClickAction="Nothing" />
                                </dg:XamDataPresenter.FieldSettings>
                                <dg:XamDataPresenter.FieldLayoutSettings>
                                    <dg:FieldLayoutSettings HeaderPrefixAreaDisplayMode="FieldChooserButton" AutoGenerateFields="False" />
                                </dg:XamDataPresenter.FieldLayoutSettings>
                                <dg:XamDataPresenter.FieldLayouts>
                                    <dg:FieldLayout>
                                        <dg:Field Name="CellName" Label="Name">
                                            <dg:Field.Settings>
                                                <dg:FieldSettings LabelClickAction="SortByOneFieldOnly" />
                                            </dg:Field.Settings>
                                        </dg:Field>
                                        <dg:Field Name="Status" Label="Status">
                                            <dg:Field.Settings>
                                                <dg:FieldSettings LabelClickAction="SortByOneFieldOnly" />
                                            </dg:Field.Settings>
                                        </dg:Field>
                                        <dg:Field Name="Version" Label="Version">
                                            <dg:Field.Settings>
                                                <dg:FieldSettings LabelClickAction="SortByOneFieldOnly" />
                                            </dg:Field.Settings>
                                        </dg:Field>
                                        <dg:Field Name="WiFi" Label="WiFi">
                                            <dg:Field.Settings>
                                                <dg:FieldSettings LabelClickAction="SortByOneFieldOnly" />
                                            </dg:Field.Settings>
                                        </dg:Field>
                                        <dg:Field Name="Battery" Label="Battery">
                                            <dg:Field.Settings>
                                                <dg:FieldSettings LabelClickAction="SortByOneFieldOnly" />
                                            </dg:Field.Settings>
                                        </dg:Field>
                                        <dg:Field Name="IpAddress" Label="Ip Address" Visibility="Collapsed">
                                            <dg:Field.Settings>
                                                <dg:FieldSettings LabelClickAction="SortByOneFieldOnly" />
                                            </dg:Field.Settings>
                                        </dg:Field>

                                        <dg:Field Name="VisiBoxStatus" Label="VisiBox Status">
                                            <dg:Field.Settings>
                                                <dg:FieldSettings LabelClickAction="SortByOneFieldOnly" />
                                            </dg:Field.Settings>
                                        </dg:Field>
                                        <dg:Field Name="VisiBoxVersion" Label="VisiBox Version">
                                            <dg:Field.Settings>
                                                <dg:FieldSettings LabelClickAction="SortByOneFieldOnly" />
                                            </dg:Field.Settings>
                                        </dg:Field>
                                        <dg:Field Name="VisiBoxWiFi" Label="VisiBox WiFi">
                                            <dg:Field.Settings>
                                                <dg:FieldSettings LabelClickAction="SortByOneFieldOnly" />
                                            </dg:Field.Settings>
                                        </dg:Field>
                                        <dg:Field Name="VisiBoxIpAddress" Label="VisiBox Ip Address" Visibility="Collapsed">
                                            <dg:Field.Settings>
                                                <dg:FieldSettings LabelClickAction="SortByOneFieldOnly" />
                                            </dg:Field.Settings>
                                        </dg:Field>


                                        <dg:Field Visibility="Collapsed" Name="LastReboot" Label="Last Reboot" />
                                        <dg:Field Visibility="Collapsed" Name="VisiBoxLastReboot" Label="VisiBox Last Reboot" />
                                    </dg:FieldLayout>
                                </dg:XamDataPresenter.FieldLayouts>
                            </dg:XamDataPresenter>
                        </Grid>
                    </Grid>

                    <!--Footer-->
                    <ContentControl Grid.Row=" 2" Template="{StaticResource FooterTemplate}" />
                </Grid>
            </igDock:ContentPane>
            <igDock:XamDockManager.Panes>
                <igDock:SplitPane igDock:XamDockManager.InitialLocation="DockedRight" Width="325" SplitterOrientation="Horizontal">
                    <igDock:ContentPane Header="{Binding ContentPaneHeader}" Style="{StaticResource RightPaneStyle}">
                        <Grid>
                            <!--VisiBoard Status properties-->
                            <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Visibility="{Binding CloneSelectedVisiBoardStatus, Converter={StaticResource ObjectNullVisibilityConverter}}">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <ig:XamPropertyGrid Grid.Row="1"  SelectedObject="{Binding CloneSelectedVisiBoardStatus}" ScrollBarVisibility="Auto" FilterAreaVisibility="Collapsed" OptionsMenuVisibility="Collapsed" >
                                    <ig:XamPropertyGrid.ItemFilters>
                                        <ig:PropertyGridConditionGroup LogicalOperator="Or" >
                                            <ig:PropertyGridComparisonCondition  Operator="Equals"  OperandSource="CategoryName" Value="1. VisiBoard" ></ig:PropertyGridComparisonCondition>
                                            <ig:PropertyGridComparisonCondition  Operator="Equals"  OperandSource="CategoryName" Value="2. VisiBox" ></ig:PropertyGridComparisonCondition>
                                        </ig:PropertyGridConditionGroup>
                                    </ig:XamPropertyGrid.ItemFilters>
                                    <ig:XamPropertyGrid.EditorDefinitions>
                                        <ig:PropertyGridEditorDefinition Category="Update History">
                                            <ig:PropertyGridEditorDefinition.EditTemplate>
                                                <DataTemplate>
                                                    <TextBlock Text ="{Binding Value}" Style="{StaticResource PropertyDataTextBlockStyle}"/>
                                                </DataTemplate>
                                            </ig:PropertyGridEditorDefinition.EditTemplate>
                                        </ig:PropertyGridEditorDefinition>

                                        <ig:PropertyGridEditorDefinition Category="Properties">
                                            <ig:PropertyGridEditorDefinition.TargetProperties>
                                                <system:String>Password</system:String>
                                            </ig:PropertyGridEditorDefinition.TargetProperties>
                                            <ig:PropertyGridEditorDefinition.EditTemplate>
                                                <DataTemplate>
                                                    <PasswordBox Style="{StaticResource PropertyPasswordBoxStyle}" MaxLength="32" vuc:ValidationSummaryValidator.AdornerSite="{Binding ElementName=vs3}"
                                            helper:PasswordHelper.BindPassword="true" helper:PasswordHelper.BoundPassword="{Binding Value, Mode=TwoWay}" />
                                                </DataTemplate>
                                            </ig:PropertyGridEditorDefinition.EditTemplate>
                                        </ig:PropertyGridEditorDefinition>

                                    </ig:XamPropertyGrid.EditorDefinitions>
                                </ig:XamPropertyGrid>


                                <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
                                </StackPanel>

                                <StackPanel Grid.Row="3">
                                    <vuc:ValidationSummary x:Name="vs3" />
                                    <TextBlock Text="{Binding CloneSelectedVisiBoardStatus.ErrorMessage}" Style="{StaticResource ErrorTextBlockStyle}" />
                                </StackPanel>
                            </Grid>
                        </Grid>
                    </igDock:ContentPane>
                </igDock:SplitPane>
            </igDock:XamDockManager.Panes>
        </igDock:XamDockManager>
    </Grid>
</visi:VisiPage>
